package com.ruoyi.chat.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chat.mapper.FriendMessageMapper;
import com.ruoyi.chat.domain.FriendMessage;
import com.ruoyi.chat.service.IFriendMessageService;

/**
 * 好友消息记录Service业务层处理
 *

 * @date 2023-07-20
 */
@Service
public class FriendMessageServiceImpl implements IFriendMessageService
{
    @Autowired
    private FriendMessageMapper friendMessageMapper;

    /**
     * 查询好友消息记录
     *
     * @param id 好友消息记录主键
     * @return 好友消息记录
     */
    @Override
    public FriendMessage selectFriendMessageById(Long id)
    {
        return friendMessageMapper.selectFriendMessageById(id);
    }

    /**
     * 查询好友消息记录列表
     *
     * @param friendMessage 好友消息记录
     * @return 好友消息记录
     */
    @Override
    public List<FriendMessage> selectFriendMessageList(FriendMessage friendMessage)
    {
        return friendMessageMapper.selectFriendMessageList(friendMessage);
    }

    /**
     * 新增好友消息记录
     *
     * @param friendMessage 好友消息记录
     * @return 结果
     */
    @Override
    public FriendMessage insertFriendMessage(FriendMessage friendMessage)
    {
        friendMessage.setCreateTime(DateUtils.getNowDate());
        Long aLong = friendMessageMapper.insertFriendMessage(friendMessage);
//        Long id = friendMessage.getId();
        return friendMessage;
    }

    /**
     * 修改好友消息记录
     *
     * @param friendMessage 好友消息记录
     * @return 结果
     */
    @Override
    public int updateFriendMessage(FriendMessage friendMessage)
    {
        friendMessage.setUpdateTime(DateUtils.getNowDate());
        return friendMessageMapper.updateFriendMessage(friendMessage);
    }

    /**
     * 批量删除好友消息记录
     *
     * @param ids 需要删除的好友消息记录主键
     * @return 结果
     */
    @Override
    public int deleteFriendMessageByIds(Long[] ids)
    {
        return friendMessageMapper.deleteFriendMessageByIds(ids);
    }

    /**
     * 删除好友消息记录信息
     *
     * @param id 好友消息记录主键
     * @return 结果
     */
    @Override
    public int deleteFriendMessageById(Long id)
    {
        return friendMessageMapper.deleteFriendMessageById(id);
    }
}
